/*******************************************************************************
  Main Source File

  Company:
    Microchip Technology Inc.

  File Name:
    main.c

  Summary:
    This file contains the "main" function for a project.

  Description:
    This file contains the "main" function for a project.  The
    "main" function calls the "SYS_Initialize" function to initialize the state
    machines of all modules in the system
 *******************************************************************************/

// *****************************************************************************
// *****************************************************************************
// Section: Included Files
// *****************************************************************************
// *****************************************************************************

#include <stddef.h>                     // Defines NULL
#include <stdbool.h>                    // Defines true
#include <stdlib.h>                     // Defines EXIT_FAILURE
#include "definitions.h"                // SYS function prototypes


// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
void MyCallback(uintptr_t context)
{
    // GPIO_PB12_Toggle();
}
int main(void)
{
    void* handle;
    printf("Hello Moorgen!\r\n");
    //LCDC_BrightnessSet(0);
    /* Initialize all modules */
    SYS_Initialize(NULL);
    PWM_ChannelsStart(PWM_CHANNEL_1_MASK);
    handle = SYS_TIME_TimerCreate(0, SYS_TIME_MSToCount(200), &MyCallback, NULL, SYS_TIME_PERIODIC);
    if (handle != SYS_TIME_HANDLE_INVALID)
    {
        printf("Timer created successfully\r\n");
    }
    while (true)
    {
        /* Maintain state machines of all polled MPLAB Harmony modules. */
        SYS_Tasks();
    }

    /* Execution should not come here during normal operation */

    return (EXIT_FAILURE);
}


/*******************************************************************************
 End of File
*/

